﻿using Caliburn.Micro;
using System;

namespace KouDai.Phone.ViewModels
{
    public class ShellPageViewModel : Conductor<IScreen>.Collection.OneActive
    {
        #region Fields

        private readonly Func<HotViewModel> _createHotTab;
        private readonly Func<CategoryViewModel> _createCategoryTab;

        #endregion

        #region Constructor
        public ShellPageViewModel(Func<HotViewModel> createHotTab,Func<CategoryViewModel> createCategoryTab)
        {
            _createHotTab = createHotTab;
            _createCategoryTab = createCategoryTab;
        }
        #endregion

        #region override
        protected override void OnInitialize()
        {
            var hotTab = _createHotTab();
            hotTab.DisplayName = "热门";
            Items.Add(hotTab);

            var categoryTab = _createCategoryTab();
            categoryTab.DisplayName = "分类";
            Items.Add(categoryTab);

            ActivateItem(Items[0]);
        }
        #endregion
    }
}
